<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/17
 * Time: 12:44
 */
namespace app\home\model;
use \think\Model;
use Captcha;
class Login extends Model{

    public function  login($mobilenum,$userpass){
        
        $user = \think\Db::name('users')->where('mobilenum','=',$mobilenum)->find();
        if($user){
            if($user['userpass']==think_weiphp_md5($userpass)){
                \think\Session::set('id',$user['id']);
                \think\Session::set('username',$user['username']);
                \think\Session::set('pic',$user['pic']);
                return 1;//登陆成功
            }else{
                return 2;//用户名密码不匹配登陆失败
            }}
        else{
                return 3 ; //用户名不存在
            }
        }
}